package com.example.majiang.mapper;

import com.example.majiang.model.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMappper {
    @Insert("insert into user (id,accountId,name,token,gmtCreate,gmtModified,avatarUrl) values(#{id},#{accountId},#{name},#{token},#{gmtCreate},#{gmtModified},#{avatarUrl})")
    void insert(User user);
    @Select("select * from user where token=#{token}")
    User findByToken(@Param("token") String token);
    @Select("select * from user where id=#{id}")
    User findById(@Param("id") Integer id);
    @Select("select * from user where accountId=#{accountId}")
    User findByAccountId(@Param("accountId")String accountId);
    @Update("update user set name = #{name}, token = #{token}, gmtModified = #{gmtModified},avatarUrl = #{avatarUrl} where id = #{id}")
    void update(User user);
}
